/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-05-22
 * Time: 21:43
 */
class A{
    int data1 = 1;

    static{
        System.out.println("父类 静态代码块执行中...");
    }
    {
        System.out.println("父类 实例代码块执行中...");
    }
    public A(int data1) {
        this.data1 = data1;
        System.out.println("父类 构造方法块执行中...");
    }
}
class B extends A{
    int data2 = 3;

    static{
        System.out.println("子类 静态代码块执行中...");
    }
    {
        System.out.println("子类 实例代码块执行中...");
    }
    public B(int data1, int data2) {
        super(data1);
        this.data2 = data2;
        System.out.println("子类 构造方法块执行中...");
    }
}

public class Test {
    public static void main(String[] args) {
        A a1 = new B(1,2);
        System.out.println("--------------------");
        A a2 = new B(3,4);
    }
}
